package com.qf.service.impl;

import com.qf.dao.MyInfoRespository;
import com.qf.pojo.MyInfo;
import com.qf.service.MyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MyInfoServiceImpl implements MyInfoService {
    @Autowired(required = false)
    MyInfoRespository myInfoRespository;

    @Override
    public List<MyInfo> findAll() {
        return myInfoRespository.findAll();
    }

    @Override
    public MyInfo findById(Integer id) {
        return myInfoRespository.findById(id).get();
    }

    @Override
    public MyInfo addAndUpdate(MyInfo myInfo) {
        return myInfoRespository.saveAndFlush(myInfo);
    }

    @Override
    public void delete(Integer id) {
        myInfoRespository.deleteById(id);
    }

    @Override
    public List<MyInfo> findByMat(Integer id) {
        return myInfoRespository.findByMat(id);
    }

    @Override
    public List<MyInfo> findByMem(Integer id) {
        return myInfoRespository.findByMem(id);
    }

    @Override
    public List<MyInfo> findByMco(Integer id) {
        return myInfoRespository.findByMco(id);
    }

    @Override
    public List<MyInfo> findByMno(Integer id) {
        return myInfoRespository.findByMno(id);
    }

    @Override
    public void deleteByMat(Integer id) {
        myInfoRespository.deleteByMat(id);
    }

    @Override
    public void deleteByMem(Integer id) {
        myInfoRespository.deleteByMem(id);
    }

    @Override
    public void deleteByMco(Integer id) {
        myInfoRespository.deleteByMco(id);
    }

    @Override
    public void deleteByMno(Integer id) {
        myInfoRespository.deleteByMno(id);
    }
}
